package org.jeecg.modules.system.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.system.entity.CyHomeManage;
import org.jeecg.modules.system.service.ICyHomeManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

 /**
 * @Description: 首页管理
 * @Author: jeecg-boot
 * @Date:   2024-12-09
 * @Version: V1.0
 */
@Api(tags="首页管理")
@RestController
@RequestMapping("/CyHomeManage/cyHomeManage")
@Slf4j
public class CyHomeManageController extends JeecgController<CyHomeManage, ICyHomeManageService> {
	@Autowired
	private ICyHomeManageService cyHomeManageService;

	 /**
	  * 查询用户所有菜单权限
	  *
	  * @return
	  */
	 //@AutoLog(value = "首页管理-通过id查询")
	 @ApiOperation(value="首页管理-查询用户所有菜单权限", notes="首页管理-查询用户所有菜单权限")
	 @GetMapping(value = "/getPermission")
	 public Result<?> getPermission() {
		 return cyHomeManageService.getPermission();
	 }


	 /**
	  * 查询当前用户快捷菜单
	  *
	  * @return
	  */
	 //@AutoLog(value = "首页管理-通过id查询")
	 @ApiOperation(value="首页管理-查询当前用户快捷菜单", notes="首页管理-查询当前用户快捷菜单")
	 @GetMapping(value = "/getList")
	 public Result<?> getList() {
		 List<CyHomeManage> homeManageList = cyHomeManageService.getList();
		 return Result.OK(homeManageList);
	 }


	 /**
	  *   保存快捷菜单数据
	  *
	  * @param saveList 要保存的快捷菜单列表
	  * @return
	  */
	 @AutoLog(value = "首页管理-保存快捷菜单数据")
	 @ApiOperation(value="首页管理-保存快捷菜单数据", notes="首页管理-保存快捷菜单数据")
	 //@RequiresPermissions("org.jeecg.modules:cy_home_manage:add")
	 @PostMapping(value = "/saveData")
	 public Result<String> saveData(@RequestBody List<CyHomeManage> saveList) {
		 cyHomeManageService.saveData(saveList);
		 return Result.OK("保存成功！");
	 }




}
